<!DOCTYPE html>
<html>
<head>
    <title>风叶的主页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="风叶的主页" />
    <script src="/js/jquery-1.11.1.min.js"></script>
</head>
<body>
<input type="text" placeholder="我是谁" required id="info"><br>
<input type="text" placeholder="公司名称" required id="name"><br>
<input type="text" placeholder="玉米名称" required id="yumi_name"><br>
<!--<input type="text" placeholder="玉米推荐地址" required id="yumi_url">-->
<br><br><br>
<?php if(!empty($tel)){foreach ($tel as $v){?>
    <div>
        <input type="text" placeholder="电话号码" required class="tele" value="<?php echo $v?>">
        <button type="button" class="submit_tel">提交</button><br>
    </div>
<?php }}else{ ?>
    <div>
        <input type="text" placeholder="电话号码" required class="tele" value="">
        <button type="button" class="submit_tel">提交</button><br>
    </div>
<?php }?>
<script>
    $('.submit_tel').click(function(){
        var name= $("#name").val();
        var info= $("#info").val();
        var yumi_name= $("#yumi_name").val();
        var telephone = $(this).siblings(".tele").val();
        $(this).css("color","red");
        $.ajax({
            type: "post",
            url: "send-sms",
            data: {name:name,yumi_name:yumi_name,telephone:telephone,info:info},
            dataType: "json",
            success: function(){
                alert("success");return false;
            }
        });
    })
</script>
</body>
</html>